翻訳と辞書
Words near each other
・ Variable pitohui
・ Variable pocket gopher
・ Variable polar pattern
・ Variable prepaid forward contract
・ Variable pricing
・ Variable Rate Application
・ Variable rate debt obligation
・ Variable rate feeder
・ Variable Rate Technology
・ Variable refrigerant flow
・ Variable reluctance sensor
・ Variable renewable energy
・ Variable retention
・ Variable rules analysis
・ Variable seedeater
Variable shadowing
・ Variable shunt reactor
・ Variable skink
・ Variable soft coral
・ Variable Specific Impulse Magnetoplasma Rocket
・ Variable speed fire pump controller
・ Variable speed of light
・ Variable speed wind turbine
・ Variable splitting
・ Variable Star
・ Variable star
・ Variable star designation
・ Variable structure control
・ Variable structure system
・ Variable sunbird


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Variable shadowing : ウィキペディア英語版
Variable shadowing
In computer programming, variable shadowing occurs when a variable declared within a certain scope (decision block, method, or inner class) has the same name as a variable declared in an outer scope. At the level of identifiers (names, rather than variables), this is known as name masking. This outer variable is said to be shadowed by the inner variable, while the inner identifier is said to ''mask'' the outer identifier. This can lead to confusion, as it may be unclear which variable subsequent uses of the shadowed variable name refer to, which depends on the name resolution rules of the language.
One of the first languages to introduce variable shadowing was ALGOL, which first introduced blocks to establish scopes. It was also permitted by many of the derivative programming languages including C++ and Java.
The C# language breaks this tradition, allowing variable shadowing between an inner and an outer class, and between a method and its containing class, but not between an if-block and its containing method, or between case statements in a switch block.
==Example==
The following Lua code provides an example of variable shadowing, in multiple blocks.

v = 1 -- a global variable
do
local v = v+1 -- creates new local that shadows global v
print(v) --> 2
do
local v = v
*2 -- another local that shadows
print(v) --> 4
end
print(v) --> 2
end
print(v) --> 1


抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Variable shadowing」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.